org.eclipse.vtp.framework.interactions.voice.vxml
Class Menu

java.lang.Object
  extended by org.eclipse.vtp.framework.interactions.core.support.Widget
      extended by org.eclipse.vtp.framework.interactions.voice.vxml.Dialog
          extended by org.eclipse.vtp.framework.interactions.voice.vxml.Menu
All Implemented Interfaces:
VXMLConstants

public class Menu
extends Dialog

The Menu class represents the <menu> VXML element. A menu is the counterpart to the form element. Instead of the free-form nature of the form's field element, a menu provides a set of choices that are typically selected with a single digit entry.

Version:
2.0
Author:
Trip Gilman, Lonnie Pryor

Field Summary
 
Fields inherited from interface org.eclipse.vtp.framework.interactions.voice.vxml.VXMLConstants
EMPTY, FILE_EXT_GSL, FILLED_MODE_ALL, FILLED_MODE_ANY, GRAMMAR_MODE_DTMF, GRAMMAR_MODE_VOICE, METHOD_GET, METHOD_POST, MIME_TYPE_GSL, MIME_TYPE_SRGS, NAME_APPLICATION, NAME_ASSIGN, NAME_AUDIO, NAME_BARGEIN, NAME_BEEP, NAME_BLOCK, NAME_BRIDGE, NAME_CATCH, NAME_CHOICE, NAME_COMPLETETIMEOUT, NAME_COND, NAME_CONFIDENCELEVEL, NAME_COUNT, NAME_DEST, NAME_DISCONNECT, NAME_DTMF, NAME_DTMFTERM, NAME_ELSE, NAME_ELSEIF, NAME_ENCTYPE, NAME_ENUMERATE, NAME_ERROR, NAME_EVENT, NAME_EVENTEXPR, NAME_EXIT, NAME_EXPR, NAME_FIELD, NAME_FILLED, NAME_FINALSILENCE, NAME_FORM, NAME_GOTO, NAME_GRAMMAR, NAME_ID, NAME_IF, NAME_INCOMPLETETIMEOUT, NAME_INPUTMODES, NAME_INTERDIGITTIMEOUT, NAME_ITEM, NAME_MAXNBEST, NAME_MAXSPEECHTIMEOUT, NAME_MAXTIME, NAME_MENU, NAME_METHOD, NAME_MODE, NAME_NAME, NAME_NAMELIST, NAME_NEXT, NAME_NOINPUT, NAME_NOMATCH, NAME_ONE_OF, NAME_OPTION, NAME_PARAM, NAME_PROMPT, NAME_PROPERTY, NAME_RECORD, NAME_REPEAT, NAME_REPROMPT, NAME_RETURN, NAME_ROOT, NAME_RULE, NAME_SCOPE, NAME_SCRIPT, NAME_SENSITIVITY, NAME_SPEEDVSACCURACY, NAME_SRC, NAME_SUBDIALOG, NAME_SUBMIT, NAME_TERMCHAR, NAME_TERMTIMEOUT, NAME_THROW, NAME_TIMEOUT, NAME_TRANSFER, NAME_TYPE, NAME_VALUE, NAME_VAR, NAME_VERSION, NAME_VXML, NAMESPACE_URI_VXML, QNAME_XML_LANG, SCOPE_DIALOG, SCOPE_DOCUMENT, TYPE_CDATA, VERSION_2_0
 
Constructor Summary
Menu(java.lang.String id, Prompt prompt)
          Creates a new instance of Menu with the specified identifier and opening prompt.
Menu(java.lang.String id, java.lang.String scope, Prompt prompt)
          Creates a new instance of Menu with the specified identifier, scope, and opening prompt.
 
Method Summary
 void addChoice(Choice choice)
          Adds the specified choice to this menu.
 Prompt getPrompt()
          Returns the opening prompt played to the caller.
 void removeChoice(Choice choice)
          Removes the specified choice from this menu.
 void setPrompt(Prompt prompt)
          Sets the opening prompt to play to the caller.
protected  void writeChoices(org.xml.sax.ContentHandler outputHandler)
          Write the choices in this menu to the specified content handler.
protected  void writePrompt(org.xml.sax.ContentHandler outputHandler)
          Writes this menu's prompt to the specified content handler.
 void writeWidget(org.xml.sax.ContentHandler outputHandler)
          Writes the content of this widget to an XML content handler.
 
Methods inherited from class org.eclipse.vtp.framework.interactions.voice.vxml.Dialog
addEventHandler, clearProperty, getID, getPropertyNames, getPropertyValue, getScope, removeEventHandler, setID, setProperty, setScope, writeAttributes, writeEventHandlers, writeProperties
 
Methods inherited from class org.eclipse.vtp.framework.interactions.core.support.Widget
toString, writeAttribute, writeChildren, writeChildren, writeWidget, writeWidget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Menu

public Menu(java.lang.String id,
            Prompt prompt)
     throws java.lang.IllegalArgumentException,
            java.lang.NullPointerException
Creates a new instance of Menu with the specified identifier and opening prompt. The set of properties and choices are initially empty. Throws an IllegalArgumentException if the prompt argument is null.

Parameters:
id - See documentation of the Dialog element.
prompt - The opening prompt.
Throws:
java.lang.IllegalArgumentException - If the supplied ID is empty.
java.lang.NullPointerException - If the supplied ID is null.
java.lang.NullPointerException - If the supplied prompt is null.

Menu

public Menu(java.lang.String id,
            java.lang.String scope,
            Prompt prompt)
     throws java.lang.IllegalArgumentException,
            java.lang.NullPointerException
Creates a new instance of Menu with the specified identifier, scope, and opening prompt. The set of properties and choices are initially empty. Throws an IllegalArgumentException if the prompt argument is null.

Parameters:
id - See documentation of the Dialog element
scope - See documentation of the Dialog element
prompt - The opening prompt.
Throws:
java.lang.IllegalArgumentException - If the supplied ID is empty.
java.lang.IllegalArgumentException - If the supplied scope is invalid.
java.lang.NullPointerException - If the supplied ID is null.
java.lang.NullPointerException - If the supplied scope is null.
java.lang.NullPointerException - If the supplied prompt is null.
Method Detail

getPrompt

public Prompt getPrompt()
Returns the opening prompt played to the caller.

Returns:
The opening prompt played to the caller.

setPrompt

public void setPrompt(Prompt prompt)
               throws java.lang.NullPointerException
Sets the opening prompt to play to the caller.

Parameters:
prompt - The opening prompt.
Throws:
java.lang.NullPointerException - If the supplied prompt is null.

addChoice

public void addChoice(Choice choice)
               throws java.lang.NullPointerException
Adds the specified choice to this menu. The choices will be presented to the caller in the order they were added.

Parameters:
choice - The choice to add.
Throws:
java.lang.NullPointerException - If the supplied choice is null.

removeChoice

public void removeChoice(Choice choice)
                  throws java.lang.NullPointerException
Removes the specified choice from this menu.

Parameters:
choice - The choice to remove.
Throws:
java.lang.NullPointerException - If the supplied choice is null.

writeWidget

public void writeWidget(org.xml.sax.ContentHandler outputHandler)
                 throws java.lang.NullPointerException,
                        org.xml.sax.SAXException
Description copied from class: Widget
Writes the content of this widget to an XML content handler.

Specified by:
writeWidget in class Widget
Parameters:
outputHandler - The handler to write this widget to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of this widget fails.

writePrompt

protected void writePrompt(org.xml.sax.ContentHandler outputHandler)
                    throws java.lang.NullPointerException,
                           org.xml.sax.SAXException
Writes this menu's prompt to the specified content handler.

Parameters:
outputHandler - The handler to write the prompt to.
Throws:
org.xml.sax.SAXException - If the writing of the prompt fails.
java.lang.NullPointerException - If the supplied content handler is null.

writeChoices

protected void writeChoices(org.xml.sax.ContentHandler outputHandler)
                     throws java.lang.NullPointerException,
                            org.xml.sax.SAXException
Write the choices in this menu to the specified content handler.

Parameters:
outputHandler - The content handler to write to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of one of the choices fails.